package com.extension.company.view.my.localorder;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.extension.company.admin.R;
import com.extension.company.common.mvc.BaseTitleActivity;
import com.extension.company.view.adapter.SameCityOrderAdapter;
import com.extension.company.view.my.localorder.localorderfragment.LocalCityOrderAllFragment;
import com.extension.company.view.my.localorder.localorderfragment.LocalCityOrderQuiteMoneyFragment;
import com.extension.company.view.my.localorder.localorderfragment.LocalCityOrderUnCommitmentFragment;
import com.extension.company.view.my.localorder.localorderfragment.LocalCityOrderUnPayFragment;
import com.extension.company.view.my.localorder.localorderfragment.LocalCityOrderUnUseFragment;
import com.extension.company.view.my.localorder.localorderfragment.LocalCityOrderUntranslateFragment;
import com.extension.company.common.widget.EnhanceTabLayout;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 同城订单--主activity
 */
public class LocalCityOrderActivity extends BaseTitleActivity {


	@BindView(R.id.fragment_my_same_city_order_tablayout)
	EnhanceTabLayout tabLayout;
	@BindView(R.id.fragment_my_same_city_order_viewpager)
	ViewPager viewpager;

	private final String[] sTitle = {"全部", "待付款", "待发货", "待使用", "待评价", "退款/售后"};
	private List<Fragment> fragmentList = new ArrayList<>();


	@Override
	public int getMainLayout() {
		return R.layout.activity_same_city_order;
	}

	@Override
	public void initView() {

	}

	@Override
	public void initData() {

		updateSuccessView();

		for (int i = 0; i < sTitle.length; i++) {
			tabLayout.addTab(sTitle[i]);
		}


		fragmentList.add(LocalCityOrderAllFragment.newInstance());
		fragmentList.add(LocalCityOrderUnPayFragment.newInstance());
		fragmentList.add(LocalCityOrderUntranslateFragment.newInstance());
		fragmentList.add(LocalCityOrderUnUseFragment.newInstance());
		fragmentList.add(LocalCityOrderUnCommitmentFragment.newInstance());
		fragmentList.add(LocalCityOrderQuiteMoneyFragment.newInstance());

		viewpager.setAdapter(new SameCityOrderAdapter(getSupportFragmentManager(), fragmentList));
		viewpager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout.getTabLayout()));
		tabLayout.setupWithViewPager(viewpager);

	}

	@Override
	public void initListener() {

	}

}
